home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 835 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.6 KB

  1. Path: newsfeed.internetmci.com!xmission!news
  2. From: tknarr@xmission.com     ( Todd Knarr )
  3. Newsgroups: comp.lang.eiffel,comp.lang.ada,comp.edu,comp.lang.c,comp.lang.c++,comp.lang.modula2,comp.lang.modula3
  4. Subject: Re: Hungarian notation
  5. Date: 7 Jan 1996 20:38:24 GMT
  6. Organization: Chaos Central
  7. Message-ID: <4cpb00$nqk@news.xmission.com>
  8. References: <30C40F77.53B5@swsbbs.com> <30EF0415.6FE1@tus.ssi1.com> <1996Jan7.045815.8676@ohstpy>
  9. Reply-To: tknarr@xmission.com   ( Todd Knarr )
  10. NNTP-Posting-Host: slc122.xmission.com
  11. X-Newsreader: IBM NewsReader/2 v1.2
  12.  
  13. In <1996Jan7.045815.8676@ohstpy>, vancleef@ohstpy.mps.ohio-state.edu writes:
  14.  
  15. >How often do you use NON-ZERO terminated strings??? HN is
  16. >useless garbage in C++, or for ANSI C compilers.
  17.  
  18. Depends on what you're doing. I'm working on some stuff involving an
  19. interface to hardware that requires counted strings because the string
  20. to/from the device may legally contain embedded NUL characters. At a
  21. higher level, we've got some "strings" that are really fixed-length arrays
  22. of char, no delimiter because their length is always the same. ( Note that
  23. I don't like them, and would prefer that they all become NUL-terminated
  24. strings, but a few hundred thousand lines of existing code isn't going to
  25. change just because of what I want ).
  26.  
  27. >HN is for rank amatuers IMHO, or Micro$oft employees :)
  28. >BTW, how *do* you do HN in c++???
  29.  
  30. That's the big downside to HN: it simply cannot be sensibly extended to
  31. deal with an arbitrarily large number of types, and it goes completely
  32. insane dealing with polymorphism. I doubt anyone could come up with a
  33. reasonable HN prefix to accomodate a variable that can be one of 9
  34. different types at any given time.
  35.  
  36. I prefer prefixes that ignore type entirely and concentrate on purpose.
  37. To me, the idea that a variable is a counter is more important than exactly
  38. what size of counter it is. If I'm calculating an integral value, I like to
  39. know if it's intended as an index into an array ( character strings come
  40. to mind here ) as opposed to, say, the total hundredths of gallons of fuel
  41. pumped from a pump. Pointers vs. arrays is about the only useful low-level
  42. concept where HN works well, because in C++ you use them in very much the
  43. same way but there are some critical semantic differences that sometimes
  44. come up and bite you.
  45.  
  46. --
  47. Todd Knarr : tknarr@xmission.com      |  finger for PGP public key
  48.                                       |  Member, USENET Cabal
  49.  
  50. Seriously, I don't want to die just yet.  I don't care how
  51. good-looking they are, I! don't! want! to! die!"
  52.                                         -- Megazone ( UF1 )
  53.  
  54.